﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>优惠券</title>
    <meta content="易工场" name="keywords">
    <meta content="易工场" name="description">
    <meta http-equiv="Cache-Control" content="max-age=180">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/style.css" rel="stylesheet" />
    <link href="font/iconfont.css" rel="stylesheet" type="text/css" />
    <link href="css/common.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/modernizr.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/swiper.min.js"></script>
    <script type="text/javascript" src="assets/js/bootstrap.js"></script>
</head>
<body>
<header>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <strong>Email: </strong>info@yourdomain.com
                &nbsp;&nbsp;
                <strong>Support: </strong>+90-897-678-44
            </div>

        </div>
    </div>
</header>
<!-- HEADER END-->
<div class="navbar navbar-inverse set-radius-zero">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">

                <img src="assets/img/logo.png" />
            </a>

        </div>

        <div class="left-div">
            <div class="user-settings-wrapper">
                <ul class="nav">

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                            <span class="glyphicon glyphicon-user" style="font-size: 25px;"></span>
                        </a>
                        <div class="dropdown-menu dropdown-settings">
                            <div class="media">
                                <a class="media-left" href="#">
                                    <img src="assets/img/64-64.jpg" alt="" class="img-rounded" />
                                </a>
                                <div class="media-body">
                                    <h4 class="media-heading">Jhon Deo Alex </h4>
                                    <h5>Developer & Designer</h5>

                                </div>
                            </div>
                            <hr />
                            <h5><strong>Personal Bio : </strong></h5>
                            Anim pariatur cliche reprehen derit.
                            <hr />
                            <a href="#" class="btn btn-info btn-sm">Full Profile</a>&nbsp; <a href="login.html" class="btn btn-danger btn-sm">Logout</a>

                        </div>
                    </li>


                </ul>
            </div>
        </div>
    </div>
</div>
<!-- LOGO HEADER END-->
<section class="menu-section">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="navbar-collapse collapse ">
                    <ul id="menu-top" class="nav navbar-nav navbar-right">
                        <li><a href="http://localhost:8083/money.html">我的支付宝</a></li>
                        <li><a href="ui.html">账户设置</a></li>
                        <li><a href="http://localhost:8083/dealinfo.html">交易记录</a></li>
                        <li><a href="http://localhost:8083/product.html">商品商城</a></li>
                        <li><a class="menu-top-active" href="http://localhost:8083/youhuijuanling.html">商品优惠券</a></li>
                        <li><a  href="http://localhost:8083/coupon.html">我的优惠券</a></li>
                        <li><a href="http://localhost:8083/recycle.html">回收站</a></li>

                    </ul>
                </div>
            </div>

        </div>
    </div>

</section>
<!-- MENU SECTION END-->
<div class="container">
    <div class="container">
        <div class="wx-containe">
            <table id="table"></table>
            <div class="tabbox tit_1" id="yhqtab">
                <div class="tab-con" style="height:300px; width:600px">
                    <ul class="yhqbox" id="a1">
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<!--
<div class="wx-top">
    <div class="top-title">优惠券</div>
</div>
<div class="top-blank"></div>
<div class="wx-containe">
    <table id="table"></table>
    <div class="tabbox tit_1" id="yhqtab">
        <div class="tab-con">
            <ul class="yhqbox" id="a1">
            </ul>
        </div>
    </div>
</div>
<div class="ft-blank"></div>
-->

<script type="text/javascript">

    $(function (){

        $.ajax
        ({
            dataType: "json",
            url: "http://localhost:8088/coupon/queryCoupon", //这里是网址
            success:function(data){

                var ua = "";
                for ( var i = 0; i < data.length; i++) {

                    if (data[i].couponType==1){

                        ua +=  '<li>'+
                            ' <div class="stamp stamp04" >'+
                            '<div class="par">\n' +
                            '<p>xxxx</p>\n' +
                            '<sub class="sign">￥</sub><span>'+data[i].couponQuota+'</span>' +
                            '<sub>'+data[i].couponCount+'</sub>\n' +
                            '<p>订单满'+data[i].couponMinAoc+'元</p>\n' +
                            '</div>\n' +
                            '<div class="copy">未领取\n' +
                            '<p>'+data[i].couponStartTime+'<br>\n' +
                            data[i].couponStartTime+'</p>\n' +
                            '<a href="javascript:addUserCoupon(\''+data[i].couponId+'\')">立即领取</a></div>\n' +
                            '<i></i> </div>\n' +
                            '</li>'
                    }
                }

                $("#a1").html(ua);

            },
            timeout:30000

        });

    })
    function addUserCoupon(id){
        alert(id)
        $.ajax
        ({
            type:"post",
            dataType: "json",
            url: "http://localhost:8088/coupon/addCouponOfUser", //这里是网址
            data:{
                "couponId":id
            },
            crossDomain:true,
            success:function(data){
                if(data.mas==0){
                    alert("你已领过刻优惠券")
                }else if(data.mas==1){
                    alert("领取成功")
                }else{
                    alert("领取失败，请重试！")
                }
            }
        });
    }

</script>
</body>
</html>
